<script type="text/javascript" src="js/functions.js" mce_src="js/functions.js"></script>

{include file="common_header.tpl"}

<img src="images/admin/icons/{$iconsImg.infoIconImg}" title="Detalles" alt="Detalles"/>&nbsp;<a href="viewplan.php?id={$idPlan}">Detalles</a>&nbsp;&nbsp;
<img src="images/admin/icons/{$iconsImg.editIconImg}" title="Editar" alt="Editar"/>&nbsp;<a href="editplan.php?id={$idPlan}">Editar</a>&nbsp;&nbsp;
<img src="images/admin/icons/{$iconsImg.tasksIconImg}" title="Contenido" alt="Contenido"/>&nbsp;<a href="contentplan.php?id={$idPlan}">Contenido</a>&nbsp;&nbsp;
<img src="images/admin/icons/{$iconsImg.acadIconImg}" title="Planos" alt="Planos"/>&nbsp;<a href="planosplan.php?id={$idPlan}">Planos</a>&nbsp;&nbsp;
<img src="images/admin/icons/{$iconsImg.historyBackIconImg}"/>&nbsp;<a href="javascript: history.back()">Volver</a>
<br/><br/><br/>



<!-- Agregar imagen -->
<div id="addimagediv" style="display: block; padding-top: 10px;">
	<form action="imagesplan.php" name="formulario" enctype="multipart/form-data" method="POST" onsubmit="return true">
		<input type="hidden" id="sendform" name="sendform" value="true"/>
		<input type="hidden" id="action" name="action" value=""/>
		<input type="hidden" id="idplan" name="idplan" value="{$idPlan}"/>	
		<table class="form">
			<tr>
				<td class="input">
					<input type="file" name="archivo" id="archivo"><input type="hidden" name="enviado" value="1">
				</td>
				<td class="botton" colspan="2" style="padding-top: 0px;">
					<input type="submit" class="confirm" value="Agregar imagen" onclick="setFormAction('add');"/>
				</td>
			</tr>
		</table>
	</form>
</div>

<br/><br/>


{if $images|@count > 0}

<!-- Lista de imagenes -->
<form id="imagesform" name="imagesform" action="imagesplan.php" method="POST" onSubmit="return true">
	
	<input type="hidden" id="sendform_items" name="sendform_items" value="true"/>
	<input type="hidden" id="action_items" name="action_items" value=""/>
	<input type="hidden" id="iditems" name="iditems" value=""/>
	<input type="hidden" id="idplan" name="idplan" value="{$idPlan}"/>
	<input type="hidden" id="info" name="info" value=""/>

	<div id="items">
		<div class="item">
		
		<input type="submit" class="confirm" value="Eliminar" onclick="setAction('removeall', 'action_items'); setIdItems(this);"/><br/><br/>
		
		<table class="listitem" cellspacing="0" cellpadding="0" width="100%">
			<tr>
				<td class="title" width="30px" align="center">
					<input type="checkbox" id="allcheck" name="allcheck" value="" onclick="checkAll(this);">
				</td>
				<td class="title" width="150px">Imagen</td>
				<td class="title" width="300px">Detalles</td>
			</tr>	
			{foreach from=$images item=image}
				<tr id="{$image.idimage}">
					<td width="30px" align="center">
						<input type="checkbox" id="{$image.idimage}" name="{$image.idimage}" value="" onclick="changeBackgroundColorItem('{$image.idimage}', this.checked);">
					</td>
					<td width="200px">
					
						<!-- Thumbnail -->
						<div id="smallimagediv_{$image.idimage}" style="display:block;">
							<a onclick="openImage('smallimagediv_{$image.idimage}', 'bigimagediv_{$image.idimage}', '../images/plan/', '{$image.file}');">
								<img src="../images/plan/small/{$image.file}"/>
							</a>
						</div>
						<!-- Imagen original -->
						<div id="bigimagediv_{$image.idimage}" style="display:none;">
						</div>
													
					</td>
					<td style="padding-left: 10px">
						<div id="imageInfoViewDiv_{$image.idimage}" style="display:block">
							{$image.info}&nbsp;&nbsp;&nbsp;<a href="#" onclick="openCloseDiv('imageInfoEditDiv_{$image.idimage}'); openCloseDiv('imageInfoViewDiv_{$image.idimage}')"><img src="images/admin/icons/{$iconsImg.editIconImg}" title="Editar" alt="Editar"/></a>
						</div>
						<div id="imageInfoEditDiv_{$image.idimage}" style="display:none">
							<input id="info_{$image.idimage}" name="info_{$image.idimage}" value="{$image.info}"/>&nbsp;&nbsp;
							<input type="image" src="images/admin/icons/{$iconsImg.saveIconImg}" value="Submit" alt="Submit" onclick="setAction('saveinfoimg', 'action_items'); setIdItem({$image.idimage}); setInput('info', getInput('info_' + {$image.idimage}));"/>&nbsp;
							<a href="#" onclick="openCloseDiv('imageInfoEditDiv_{$image.idimage}'); openCloseDiv('imageInfoViewDiv_{$image.idimage}')"><img src="images/admin/icons/{$iconsImg.historyBackIconImg}"/></a>
						</div>
					</td>
				</tr>
			{/foreach}
		</table>
		</div>
	</div>
</form>
{/if}

{include file="common_footer.tpl"}